package com.demo.provider.service.impl;

import api.AsyncService;
import org.apache.dubbo.config.annotation.Service;
import org.apache.dubbo.rpc.AsyncContext;
import org.apache.dubbo.rpc.RpcContext;


@Service
public class AsyncServiceImpl implements AsyncService {

    @Override
    public String sayHello(String name) {

        final AsyncContext asyncContext = RpcContext.startAsync();
        new Thread(() -> {
            asyncContext.write("Hello " + name + ", response from provider.");
        }).start();
        return null;
    }
}
